package sensors;

import flixel.addons.tile.FlxTilemapExt;
import level.Tiles;

class OrSensor extends DependentSensor
{
	public function new(X: Float, Y: Float, map: FlxTilemapExt){
 		super(X, Y, map);	
	}

	override public function update()
	{
		super.update();
		if(_parents.length == 0) return;
		
		for(i in 0..._parents.length)
		{
			if(_parents[i].isActive)
			{
				activate();
				return;
			}
		}
		deactivate();
	}

	override public function activate()
	{
		drawTile(Tiles.OR_SENSOR_ON);
		super.activate();
	}

	override public function deactivate()
	{
		drawTile(Tiles.OR_SENSOR_OFF);
		super.deactivate();
	}
}